package com.kirk.cts.core.runcycle.schedule.processor.support;

import com.kirk.cts.core.cache.ICrawlerToolCacheManager;
import com.kirk.cts.core.runcycle.schedule.Schedule;
import com.kirk.cts.core.runcycle.schedule.processor.IRunScheduleProcessor;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * <p> CacheScheduleProcessor.java </p>
 *
 * @version 1.0.0
 * @Author kirkliu
 * @Date 2020-08-30 16:52
 * @Description
 */
@Component("cacheScheduleProcessor")
public class CacheScheduleProcessor extends AbstractScheduleProcessor implements IRunScheduleProcessor {

    @Resource(name = "crawlerToolCacheManager")
    private ICrawlerToolCacheManager crawlerToolCacheManager;

    @Override
    public int getIndex() {
        return 1;
    }

    @Override
    protected void doExecute(Schedule schedule) {
        crawlerToolCacheManager.run();
    }

    @Override
    protected boolean isNewThread() {
        return true;
    }

}
